package com.uzai.console.web.module;

import com.github.xiaoymin.knife4j.annotations.ApiSort;
import com.uzai.console.annotation.SystemLogType;
import com.uzai.console.dto.module.merchant.MerchantSetDeviceTypeDto;
import com.uzai.console.enums.OperationTypeEnum;
import com.uzai.console.enums.SystemModelEnum;
import com.uzai.console.service.module.MerBaseConfigService;
import com.uzai.console.vo.module.merchant.MerchantDeviceTypeVo;
import com.uzai.console.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;


/**
 * @author liuqi
 * @date 2021年08月12日 17:23
 */
@Api(value = "私域场景",tags = "模块设置|私域场景")
@ApiSort(3)
@RestController
public class MerchantController extends BaseController {
    private Logger logger = LoggerFactory.getLogger(MerchantController.class);

    @Autowired
    private MerBaseConfigService merBaseConfigService;

    @ApiOperation(value = "查询运营商设备列表", notes = "查询运营商设备列表", response = MerchantDeviceTypeVo.class)
    @PostMapping("/merchant/findDeviceTypeList")
    public Object findDeviceTypeList(){
        return merBaseConfigService.findMerDeviceTypeList(getLoginInfo().getMerId());
    }


    @SystemLogType(model = SystemModelEnum.Merchant, type = OperationTypeEnum.UPDATE)
    @ApiOperation(value = "运营商启用关闭设备", notes = "运营商启用关闭设备", response = Boolean.class)
    @PostMapping("/merchant/setDeviceType")
    public Object setDeviceType(@RequestBody MerchantSetDeviceTypeDto merchantSetDeviceTypeDto){
        return merBaseConfigService.setDeviceType(merchantSetDeviceTypeDto);
    }

}
